<head th:fragment="headerCss">
    <meta charset="utf-8">
    <title>湖南金职伟业母婴护理有限公司</title>
    <meta content="width=device-width, initial-scale=1.0" name="viewport">
    <meta name="keywords" content=""/>
    <meta name="description"
          content="湖南金职伟业母婴护理有限公司"/>
    <link rel="stylesheet" href="/js/layui/css/layui.css">
    <!-- Bootstrap CSS File -->
    <!--<link href="/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">-->
    <link rel="stylesheet" href="/css/examination/common.css">
    <link href="/css/font-awesome.css?v=4.4.0"
          th:href="@{/css/font-awesome.css?v=4.4.0}" rel="stylesheet">
    <!-- Google Fonts -->
    <link rel="shortcut icon" href="favicon.ico">
    <link rel="stylesheet" href="/css/swiper-bundle.css">

    <style>
        .ti1{float: left;width: 20%;line-height: 42px;color: #333}
        .ti2{float: right !important;width: 75%;text-align: left !important;}
        #examinationList,.layui-input{border-color: #ccc;border-radius: 5px;color: #999 !important; font-size: 12px !important;}
        .windowstor{height: initial;}
        .tips{font-size: 25px;color: #E60214;display: none;width: 400px;margin: 30px auto 0;}

        .newtoptit{width: 100%;margin: 75px auto 37px; text-align: center;}
        .newtoptit img{width: 128px;height: 126px;display: block;margin: 0 auto;}
        .newaddtips{margin: 0;padding: 0 70px;box-sizing: border-box;}
    </style>
</head>
<body class="signin">

<div class="main_content has_back">
    <div class="window_box windowstor">
        <div class="leftForm">

<!--            <div class="toptit"><img src="/img/red_logo.png" /></div>-->

            <div class="tips" id="tips">请升级你的浏览器，该浏览器不支持此考试系统，建议使用谷歌浏览器！(谷歌浏览器可进行正常考试)</div>

            <div class="newtoptit"><img src="https://jinzhiweiye.oss-cn-hangzhou.aliyuncs.com/2022/xx/1124/logo.png"></div>

            <input type="hidden" th:value="${name}" id="entrname"/>
            <input type="hidden" th:value="${typeName}" id="typeName" />
            <input type="hidden" th:value="${ticketNumber}" id="ticketNumberVal">

            <div class="entryTle newaddtips">育婴员赛项理论考试入口 <br/>（院校竞赛组）</div>
<!--            <div class="entryTle newaddtips">育婴员赛项理论考试入口 <br/>（市州竞赛组）</div>-->
<!--            <div class="entryTle newaddtips">保育师赛项理论考试入口 <br/>（市州竞赛组）</div>-->
<!--            <div class="entryTle newaddtips">保育师赛项理论考试入口 <br/>（院校竞赛组）</div>-->

            <div class="loginIn">

                <div class="item">
                    <label class="ti1">姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名</label>
                    <input  type="text" id="username" placeholder="请输入姓名" autocomplete="new-password" class="ti2 layui-input">
                    <div style="clear: both"></div>
                </div>

                 <div class="item">
                    <label class="ti1">考生编号</label>
                    <input type="text" id="ticketNumber" placeholder="请输入考生编号" autocomplete="new-password"
                           class="ti2 layui-input">
                    <div style="clear: both"></div>
                </div>

                <div class="item">
                    <label class="ti1">考试编号</label>
                    <input type="text" id="idNumber" placeholder="请输入考生编号" autocomplete="new-password" class="ti2 layui-input">
                    <div style="clear: both"></div>
                </div>

                <div class="item">
                    <input type="hidden" th:value="${time}" id="times" />
                    <input type="hidden" th:value="${dates}" id="dates" />
                    <input type="hidden" th:value="${img}" id="imgs" />
                    <a href="javascript:;" class="layui-btn layui-btn-fluid layui-btn-danger" onclick="login()"
                       id="submitBtn">登 录</a>
                </div>
            </div>
        </div>
        <div class="carousel">

            <div class="swiper mySwiper">
                <div class="swiper-wrapper" id="swiper"></div>
            </div>

        </div>
    </div>
    
</div>

<script>

    function isIE() {
        if (!!window.ActiveXObject || "ActiveXObject" in window)
            return true;
        else
            return false;
    }

     if( isIE() ){
         document.getElementById('tips').style.display = 'block';
     }

</script>

<script src="/js/jquery.min.js?v=2.1.4" th:src="@{/js/jquery.min.js?v='2.1.4'}"></script>
<script src="/js/plugins/layer/layer.min.js" th:src="@{/js/plugins/layer/layer.min.js}"></script>
<script src="/js/swiper-bundle.js"></script>
<script type="text/javascript">

    //回车登录
    var examinationListIntro = null, gather = [] ;
    document.onkeydown =cdk;
    function cdk(){
        if(event.keyCode ==13){
            login();
        }
    }
    var id=null;
    $(function () {

        let entrname = $("#entrname").val();
        let typeName = '('+$("#typeName").val()+')';
        localStorage.setItem('entrname',entrname);
        localStorage.setItem('typeName',typeName);
        $(".newaddtips").html(entrname);

        $.ajax({
            url: "/jzApi/examinations/selExamination",
            async : false,
            success: function (r) {
               //console.log("r",r)
                if(r.code !=-1){
                    if(window.localStorage){
                        //window.localStorage.setItem("intro",JSON.stringify(r.data));
                        // window.localStorage.setItem("backGroundImage",r.data.backGroundImage);
                    }else{
                        layer.msg("请换浏览器，最佳为谷歌")
                    }
                    examinationListIntro = r.data;
                    // window.localStorage.setItem("listIntro",JSON.stringify(examinationListIntro));
                    for(var p in r.data){
                        $("#examinationList").append("<option value='"+r.data[p].id+"'>"+r.data[p].name+"</option>");
                	}
                    $("#title").html('1+X幼儿照护证书在线考试');
                   //id = r.data.id
                }else{
                    $("#title").html('暂无在线考试');
                }
            }
        });
    });

    function login() {
        var username = $("#username").val();
        var idNumber = $("#idNumber").val();
        var ticketNumber = $("#ticketNumber").val();
        // var examinationId = $("#ticketNumberVal").val();
        // if ('' == examinationId) {
        //     layer.msg('请选择考试批次');
        //     return false
        // }
        if ('' == username) {
            layer.msg('请输入姓名');
            return false
        }
        if ('' == idNumber) {
            layer.msg('请输入考生编号');
            return false
        }
        if ('' == ticketNumber) {
            layer.msg('请输入准考证号');
            return false
        }
        $.ajax({
            type: "POST",
            url:  "/jzApi/examinations/loginExamination",
            data: {name:username , idNumber:idNumber, ticketNumber:ticketNumber},
            success: function (r) {

                if (r.code == 0) {
                    let userinfo = JSON.parse(window.localStorage.getItem("info"));
                    if( userinfo ){
                        if( r.data.ticketNumber == userinfo.ticketNumber ){
                            location.href = '/examination/startExam'
                        }else{
                            localStorage.clear();
                        }
                    }

                    $.get('/jzApi/examinations/getBatch',{id:r.data.cbatchId},function (data){
                        window.localStorage.setItem("intro", JSON.stringify( data.data ) )
                    })

                    if(window.localStorage){
                    	// for(var e in examinationListIntro){
                    	// 	if(examinationListIntro[e].id == examinationId){
                        //
                        //         // window.localStorage.setItem("intro"+r.data.idCard,JSON.stringify(examinationListIntro[e]));
                        //         window.localStorage.setItem("intro",JSON.stringify(examinationListIntro[e]));
                    	// 		break;
                    	// 	}
                    	// }
                        window.localStorage.setItem("info",JSON.stringify(r.data));
                        window.localStorage.setItem("nowDate",r.data.nowDate);
                        window.localStorage.setItem("times",JSON.stringify($('#times').val()));
                        window.localStorage.setItem("dates",JSON.stringify($('#dates').val()));

                    }else{
                        layer.msg("请换浏览器，最佳为谷歌")
                    }
                    location.href = '/examination/startExam'
                } else {
                    layer.msg(r.msg);
                }
            }
        });
    }

    $.ajax({
        type: "POST",
        url:  "/jzApi/examinations/serversBanners",
        success: function (r) {
            var str = '';
            if (r.code == 0) {

                if( $("#imgs").val().length ){
                    str = `
                        <div class="swiper-slide slide">
                            <img src="${$("#imgs").val()}" alt="">
                        </div>
                  `;
                }

                r.data.forEach(function (item){
                    str += `
                            <div class="swiper-slide slide">
                                <img src="${item.value}" alt="">
                            </div>
                          `;
                })
                $("#swiper").html(str)
            } else {
                layer.msg(r.msg);
            }

            //    轮播图
            var swiper = new Swiper(".mySwiper", {
                autoplay:true
            });

        }
    });


</script>
</body>





